<template>
  <basic-container :btnFlag="true">
          <div class="card-border">
            <card-header :header-data="headerData"></card-header>
        <el-table :data="watchData" style="width: 100%">
        <el-table-column  label="分解项名称" width="360">
          <template slot-scope="scope">
            <a style="cursor: pointer;" @click="submit(scope.row,true)">{{scope.row.itemName}}</a>
          </template>
        </el-table-column>
        <el-table-column prop="leadDeptName" label="责任部门"></el-table-column>
        <el-table-column label="类别" width="100">
             <template slot-scope="scope">
            <a>{{scope.row.type==1?'指标':scope.row.type==2?'任务':scope.row.type==3?'项目':''}}</a>
          </template>
        </el-table-column>
        <el-table-column label="上报周期" width="100">
          <template slot-scope="scope">
            <span>{{scope.row.type?'年报':''}}</span>
          </template>
        </el-table-column>
         <el-table-column align="center" prop="state" width="100" label="本期状态">
              <template slot-scope="scope">
                  <span v-if="scope.row.isReport=='2'"
                        style="color:red;">未上报</span>
                  <span v-if="scope.row.isReport=='1'"
                        style="color:green;">已上报</span>
              </template>
            </el-table-column>
      </el-table>
          </div>
      </basic-container>
</template>
<script>
import { decomposeItemItemPage } from "@/api/pim/pim";
export default {
    data(){
        return{
            watchData:[],
            headerData:{
            title: "进度详情"
         }
        }
    },
    created(){
        this.checkProgress()
    },
    methods:{
        // 上报进度
    submit(row, watch) {
      let src = `/pim/workingItem/submit`;
      console.log(row, watch);
      // return;
      this.$router.push({
        path: src,
        query: {
          id: row.id,
          watch: watch,
          startDate:row.startDate,
          endDate:row.endDate,
          itemName: row.itemName,
          type: row.type,
          submitPeriod: row.submitPeriod,
          list: true,
        }
      })
    },
         //查看进度
    checkProgress(row) {
      decomposeItemItemPage({ pmuc: this.$route.query.pmuc}).then(response => {
        if (response.data.code == 0) {
          this.watchData = response.data.data.records;
        }
      });
    },
    }
}
</script>
<style lang="scss" scoped>

</style>

